/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mysql;
import java.sql.Connection;
import java.sql.DriverManager;
//import java.sql.ResultSet;
//import java.sql.SQLException;
//import java.sql.Statement;
/**
 *
 * @author MeoMupU
 */
public class ConnectToMysql {
 public static void main (String[] args)
 {
     Connection conn = null;
     try
     {
         String userName = "root";
         String password ="";
         String url = "jdbc:mysql://127.0.0.1:3306/muachung";
         
         conn = DriverManager.getConnection(url,userName, password);
         if(conn!=null)
         {
             System.out.println("Da ket noi CSDL"); 
         }
        
         conn.close();
         //System.out.println("Dong ket noi");
     }
     catch(Exception e)
     {
         System.err.println("Khong ket noi CSDL duoc");
     }
 }
}